<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>打开 bzip2 压缩文件</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.bzopen" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">bzopen</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">bzopen</span> &mdash; <span class="dc-title">打开 bzip2 压缩文件</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.bzopen-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>bzopen</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$file</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$mode</code></span>
   ) : <span class="type">resource</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>bzopen()</strong></span> 打开一个 bzip2（.bz2）文件用于读或写。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.bzopen-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">file</code></dt>

     <dd>

      <p class="para">
       待打开的文件的文件名，或者已经存在的资源流。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">mode</code></dt>

     <dd>

      <p class="para">
       支持 &#039;r&#039;（读）和 &#039;w&#039;（写）模式。
       其他任何模式都会导致 <span class="function"><strong>bzopen()</strong></span> 返回 <strong><code>FALSE</code></strong>。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.bzopen-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果打开失败，<span class="function"><strong>bzopen()</strong></span> 会返回 <strong><code>FALSE</code></strong>，否则返回一个指向最新打开文件的指针。
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.bzopen-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-699">
    <p><strong>Example #1 <span class="function"><strong>bzopen()</strong></span> 范例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"/tmp/foo.bz2"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$bz&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">bzopen</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"r"</span><span style="color: #007700">)&nbsp;or&nbsp;die(</span><span style="color: #DD0000">"Couldn't&nbsp;open&nbsp;</span><span style="color: #0000BB">$file</span><span style="color: #DD0000">&nbsp;for&nbsp;reading"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">bzclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$bz</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.bzopen-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="bzclose.html" class="function" rel="rdfs-seeAlso">bzclose()</a> - 关闭一个 bzip2 文件</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>